from typing import Callable


class Log:
    __log_function = print
    __log_level = 0

    @classmethod
    def set_log_function(cls, function: Callable[[str], None]):
        cls.__log_function = function

    @classmethod
    def set_log_level(cls, level: int):
        cls.__log_level = level

    def __init__(self, string: str, level: int = 0):
        if level >= self.__log_level:
            if self.__log_function == print:
                print(f'[{level}]: {string}', flush=True)
            else:
                self.__log_function(f'[{level}]: {string}')

    @classmethod
    def log_level(cls) -> int:
        return cls.__log_level
